1484241967 by Unknown
Author:Unknown
Language: eng
Format: epub
Published: 2018-11-30T07:01:40+00:00
Chapter 6 Week 6: C++
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib/libcrypto.so (found version
"1.1.0i")
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- system
-- Found CURL: /usr/lib/libcurl.so (found version "7.61.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/niko/Dropbox/BOOKS2/
APRESS/06-cplusplus/samplecmake
If you are writing code from Visual Studio Code again, there is a
specific and dedicated plug-in, created by Microsoft, that you can install (Figure 6-1).
Figure 6-1. C/C++ plug-in for Visual Studio Code
116
Chapter 6 Week 6: C++
With the plug-in installed, you can start typing C++ code and your first C++ program of the day.
Here is a list of reminders before proceeding to look at the code:
• #include is used to include namespaces
• Using namespace will prevent you from having to
insert the namespace in front of each symbol of given
namespaces, thus, std::string will become string,
for example.
• intmain(intargc, char* argv[]) is the main entry
point, and you can retrieve the number of args, as well
as an array of parameters. Note that the first parameter
is at index 0 and is the command name itself. Here, it
will be samplecmake, as it was defined in the project
metadata file, CMakeLists.txt.
• auto url means that we do not specify the type of the
variable ourselves; the compiler does it. Here, it will
actually be a char*, which is a pointer to an array of
characters.
• We will actually download the file using a system
command, curl (which should be installed on your
machine).
• The shell command curl is called using the system
function, with url as the parameter to the curl
command.
This now gives the slightly readable code snippet following, which should be saved in a file named main.cpp.
#include <string>
using namespace std;
117
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sita - Warrior of Mithila (Book 2 of the Ram Chandra Series) by Amish(51541)
The Crystal Crypt by Dick Philip K(35687)
Cat's cradle by Kurt Vonnegut(13879)
Always and Forever, Lara Jean by Jenny Han(13648)
Ready Player One by Cline Ernest(12850)
The Last by Hanna Jameson(9232)
Year One by Nora Roberts(8482)
Persepolis Rising by James S. A. Corey(8273)
The remains of the day by Kazuo Ishiguro(7564)
Dark Space: The Second Trilogy (Books 4-6) (Dark Space Trilogies Book 2) by Jasper T. Scott(7379)
Red Rising by Pierce Brown(7339)
Never let me go by Kazuo Ishiguro(7142)
The handmaid's tale by Margaret Atwood(6866)
The Circle by Dave Eggers(6264)
Legacy by Ellery Kane(5948)
The Testaments by Margaret Atwood(5787)
Frank Herbert's Dune Saga Collection: Books 1 - 6 by Frank Herbert(5744)
Pandemic (The Extinction Files Book 1) by A.G. Riddle(5595)
Six Wakes by Mur Lafferty(5207)